package com.sms.controller;

import cn.hutool.json.JSONConfig;
import cn.hutool.json.JSONUtil;
import com.sms.common.A;
import com.sms.pojo.ConsignmentProducts;
import com.sms.service.impl.ConsignmentProductsServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
//代销商品列表
@WebServlet("/ConsignmentProductsList")
public class ConsignmentProductsListController extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        ConsignmentProductsServiceImpl service=new ConsignmentProductsServiceImpl();
        List<ConsignmentProducts> list = service.listConsignmentProducts();
        service.getSqlSession().close();
        resp.getWriter().write(JSONUtil.toJsonStr(A.success("代销商品查询成功",list), JSONConfig.create().setDateFormat("yyyy-MM-dd")));

    }
}
